// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
    env: "cloud1-5g9np9s88a72a0bc"
});

// 云函数入口函数
exports.main = async (event, context) => {
    return await cloud.database().collection('project')
        .add({
            data: {
                taskTitle: event.taskTitle,
                taskType: event.taskType,
                startDateStamp: event.startDateStamp,
                endDateStamp: event.endDateStamp,
                signEndDateStamp: event.signEndDateStamp,
                region: event.region,
                peopleNum: event.peopleNum,
                phoneNum: event.phoneNum,
                taskDetail: event.taskDetail,
                imageUrl: event.imageUrl,
                pubTimeStamp: event.pubTimeStamp,
                pubYear: event.pubYear,
                pubMonth: event.pubMonth,
                pubDate: event.pubDate,
                startTime: event.startTime,
                endTime: event.endTime,
                vlnListNotAdmit: [],
                vlnListHasAdmit: [],
                projectId: event.projectId,
                teamOpenid: event.teamOpenid,
                teamNickname: event.teamNickname,
                teamAvatraurl: event.teamAvatraurl,
            }
        })
        .then(res => {
            console.log("调用成功", res)
        })
        .catch(res => {
            console.log("调用失败", res)
        })
}